package com.sunyzc.ebaotech.ybt.simulator;

import java.io.IOException;
import java.io.InputStream;

public interface IProcessor {
	public final static String SERVER_HOST_YBT_LOCALHOST = "172.30.1.205";
	public final static String SERVER_HOST_YBT_LS4_DEV = "172.25.13.87";
	public final static String SERVER_HOST_YBT_LS4_INT = "172.25.13.86";
	public final static String SERVER_HOST_YBT_PREPORD = "172.25.12.75";

	public String getServerHost();

	public void setServerHost(String serverHost);

	/**
	 * 8100 - 邮储(POST) <br>
	 * 8101 - 农行(ABC) <br>
	 * 8102 - 工行(ICBC) <br>
	 * 8103 - 建行(CCB) <br>
	 * 8104 - 北京农商行(BJRCB) <br>
	 * 8105 - 光大(CEB) <br>
	 * 8106 - 建行(CCB) <br>
	 * 8107 - 中行(BOC) <br>
	 * 8108 - 广州农商行(GZRCB) <br>
	 * 8109 - 交行(COMM) <br>
	 * 8110 - 东莞农商行(DGRCB) <br>
	 * 8111 - 顺德农商行(SDRCB) <br>
	 * 39871 - 建行(CCBNEW) <br>
	 */
	public int getServerPort();

	/** 设置服务器时间相对于本地时间的日期偏移量 */
	public void setDateOffSet(int dateOffset);

	/** 日期格式统一为yyyyMMdd，然后再转换成各个银行报文中的日期格式 */
	public void setCurrentDate(String currentDateStr);

	/** 根据形如RP1002-PolicyNo的transXmlMapKey从历史报文中获取相应节点的值 */
	public String getElementValue(String transXmlMapKey);

	/** 根据形如RP1002-PolicyNo的transXmlMapKey从历史报文中获取相应节点的值，如果没有找到节点则返回defaultValue默认值 */
	public String getElementValue(String transXmlMapKey, String defaultValue);

	public byte[] generateHeadBytes(String transType, byte[] requestBodyContent) throws Exception;

	/** 根据transType获取请求报文模板 */
	public String generateRequestBodyTemplateStr(String transType) throws Exception;

	/** 根据请求报文模板，静态替换流水号、交易日期、交易时间等字段，然后正则替换保单号、保费等字段 */
	public byte[] generateRequestBodyBytes(String transType, String requestBodyTemplateStr) throws Exception;

	public byte[] generateResponseBodyBytes(String transType) throws Exception;

	public byte[] convertContentStrToBytes(String contentStr) throws Exception;

	public String convertContentBytesToStr(byte[] contentBytes) throws Exception;

	public String readHeadConetentStr(String transType, InputStream inputStream) throws IOException;

	public String readBodyConetentStr(String transType, InputStream inputStream, String headContentStr) throws Exception;
}
